﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaiser.Models;
using Kaiser.Models.SearchModels;
using Kaiser.Modules.Admin.Repositories;

namespace Kaiser.Repositories.iBatis.SYS
{
    public class AttachRepository : IAttachRepository
    {
        private readonly IBatisHepler _batisHepler = null;
        public AttachRepository()
        {
            _batisHepler = new BatisHepler("SQLMap.SYS.config");
        }

        public void Insert(Models.Attach model)
        {
            var result = _batisHepler.ExcuteInsert("InsertAttachment", model);
        }


        ///// <summary>
        ///// 新增
        ///// </summary>
        ///// <param name="model"></param>
        //public int InsertAttachment(Modules.Hiner.Models.Product.Attachment model)
        //{
        //    var result = _batisHepler.ExcuteInsert("InsertAttachment", model);
        //    return Convert.ToInt32(result);
        //}

        //public Modules.Hiner.Models.Product.Attachment GetAttachment(string pid)
        //{
        //    var result = _batisHepler.ExcuteSelectObj("GetAttachment", pid) as Modules.Hiner.Models.Product.Attachment;
        //    return result;
        //}

        public void Update(Models.Attach model)
        {
            throw new NotImplementedException();
        }

        public int Delete(object primaryId)
        {
            var parms = new Hashtable();
            parms["ids"] = primaryId.ToString().Split(',');
            var result = _batisHepler.ExcuteDelete("DeleteProduct", primaryId);
            return result;
        }

        public Models.Attach Get(object primaryId)
        {
            Attach result = _batisHepler.ExcuteSelectObj("GetAttachment", primaryId) as Attach;
            return result;
        }

        public int DeleteList(IList<string> ids)
        {
            var result = _batisHepler.ExcuteDelete("DeleteAttachment", ids);
            return result;
        }

        public DataGrid<Attach> SearchAttach(AttachSearch search, PagingInfo pageinfo)
        {
            throw new NotImplementedException();
        }
    }
}
